package com.sx.admin.shiro;


import com.sx.core.model.Operator;
import org.apache.shiro.authz.SimpleAuthorizationInfo;

import java.io.Serializable;
import java.util.List;

/**
 * 授权用户信息
 */
public class AdminPrincipal implements Serializable {

    private static final long serialVersionUID = 1L;

    private Operator operator;
    private SimpleAuthorizationInfo authorizationInfo=new SimpleAuthorizationInfo();

    public AdminPrincipal(Operator operator, List<String> perms) {
        this.operator=operator;
        authorizationInfo.addStringPermissions(perms);
    }

    public Operator getOperator() {
        return operator;
    }

    public void setOperator(Operator operator) {
        this.operator = operator;
    }

    public SimpleAuthorizationInfo getAuthorizationInfo() {
        return authorizationInfo;
    }

    public void setAuthorizationInfo(SimpleAuthorizationInfo authorizationInfo) {
        this.authorizationInfo = authorizationInfo;
    }

    @Override
    public String toString() {
        return operator.getOpercode();
    }

}